/**
 * 考核类型
 */
const AssessType = {
  CORP: 0,
  DEPT: 1
}

/**
 * 考核载体类型。‘0’：扣分；‘1’：加分
 */
const CarrierType = {
  ADD: '1',
  SUB: '0'
}

/**
 * 整改操作类型对象
 */
const RectStep = {
  FIND: '0',
  PLAN: '1',
  APPR: '2',
  EXEC: '3',
  ACCE: '4'
}

/**
 * 整改状态
 */
const RectStatus = {
  INIT: 'unprocess',
  TASK: 'duty',
  PLAN: 'rectify',
  REJECT: 'reject_duty',
  PRE_APPR: 'manage_approve',
  APPR: 'approve',
  EXEC: 'commit',
  PRE_ACCE: 'manage_complete',
  ACCE: 'complete'

}

/**
 * 操作类型
 * grade: 打分
 * check：审核
 * feedback：反馈
 * approve：打分反馈审核，加分申请审核
 * review：打分反馈复核，加分申请复核
 * apply：新建加分申请
 */
const OperateType = {
  GRADE: 'grade',
  CHECK: 'check',
  FEEDBACK: 'feedback',
  MODIFY: 'feedback_modify',
  APPROVE: 'approve',
  RECHECK: 'approve_review',
  REVIEW: 'review',
  FINAL: 'complete',
  APPLY: 'create',
  SAVE: 'save'
}

/**
 * { text: '全部考评', value: '' },
 { text: '待评分', value: '0' },
 { text: '待审核', value: '1' },
 { text: '审核通过', value: '2' },
 { text: '反馈待本部门审核', value: '3' },
 { text: '反馈待局领导复核', value: '4' },
 { text: '反馈待最终审核', value: '5' },
 { text: '反馈待修改', value: '6' },
 { text: '考评结束', value: '7' }
 */
const GradeStatus = {
  GRADE: 0,
  CHECK: 1,
  FEEDBACK: 2,
  APPROVE: 3,
  RECHECK: 4,
  REVIEW: 5,
  MODIFY: 6,
  FINAL: 7,
  SAVE: 8
}

/**
 * 加分申请状态
 *
 */
const ApplyStatus = {
  CREATE: 0,
  CHECK: 1,
  RECHECK: 2,
  REVIEW: 3,
  MODIFY: 4,
  FINAL: 5
}

/**
 * 创建考评列表查询对象
 * pageNum（必填）当前页码，从1开始
 * pageSize（必填 每页列表大小
 * user_id（必填）当前用户userid
 * op（必填）grade-当前人作为打分人，view-当前人作为被考核单位人员
 * problem_status（选填）打分问题状态 0-未打分，1-待审核，2-审核通过，3-待反馈审核，4-待打分部门同意反馈，5-问题结束
 * problem_type（必填）问题类型 0-公司对单位打分，1-单位对部门打分
 * matters（选填）业务事项（即考核载体描述字符串）
 * assessment_dept（选填）考核部门全路径
 */
const createCondition = function () {
  let obj = {}
  obj.assessment_dept = ''
  obj.matters = ''
  obj.problem_status = ''
  obj.problem_type = ''
  obj.apply_status = ''
  obj.apply_type = ''
  obj.op = ''
  obj.user_id = ''
  obj.pageNum = 1
  obj.pageSize = 1000
  obj.department_path = ''
  obj.batchDept = ''
  obj.scope = '0'

  // 整改列表专用
  obj.user_dept = ''
  obj.rectify_status = ''

  return obj
}

/**
 * 创建部门对象
 */
const createDepartment = function () {
  let obj = {}
  obj.department_name = null
  obj.department_path = null
  obj.department_pathname = null
  obj.id = 0
  obj.order = 0
  obj.pid = 0
  return obj
}

/**
 * 创建考核载体对象
 */
const createCarrier = function () {
  let obj = {
    id: '',
    item: '',
    content_item: {
      id: '',
      item: '',
      score_item: []
    }
  }
  return obj
}

/**
 * 创建业务操作对象
 *
 */
const createOperate = function () {
  let obj = {}
  obj.approve_result = ''
  obj.approve_userid = ''
  obj.approve_username = ''
  obj.problem_id = ''
  obj.refuse_reason = ''
  obj.feedback_reason = ''
  obj.feedback_score = ''
  obj.receivers = []
  obj.new_score = 's'
  return obj
}

/**
 * 创建加分申请内容实体对象
 */
const createApply = function () {
  let obj = {}
  obj.id = ''
  obj.asse_dept = ''
  obj.carrier_item = ''
  obj.add_reson = ''
  obj.score = ''
  obj.user_id = ''
  obj.user_name = ''
  obj.apply_dept = ''
  obj.apply_status = ''
  obj.apply_time = ''
  obj.file_url = ''
  obj.file_name = ''
  obj.apply_type = ''
  return obj
}

/**
 * 创建考核内容实体对象
 */
const createGrade = function () {
  let obj = {}
  obj.assessment_dept = ''
  obj.category = ''
  obj.check_item = ''
  obj.check_time = ''
  obj.check_pattern = ''
  obj.check_userid = ''
  obj.check_username = ''
  obj.classification = ''
  obj.company = ''
  obj.department_path_name = ''
  obj.description = ''
  obj.expert = ''
  obj.grade_time = ''
  obj.id = ''
  obj.input_time = ''
  obj.matters = ''
  obj.ownership = ''
  obj.person = ''
  obj.problem_status = ''
  obj.root_cause = ''
  obj.score = ''
  obj.suggestions = ''
  obj.problem_type = ''
  return obj
}

const createRectifyFormData = function () {
  let obj = {}
  obj.op = ''
  obj.problem_type = ''
  obj.user_id = ''
  obj.user_name = ''
  obj.user_dept = ''
  obj.approve_result = ''
  obj.approve_content = ''
  obj.rectifyProblem = {}
  return obj
}
export default { AssessType, CarrierType, OperateType, RectStep, RectStatus, GradeStatus, ApplyStatus, createCondition, createCarrier, createDepartment, createOperate, createApply, createGrade, createRectifyFormData }
